export default function uuid() {
  const arr = self.crypto.getRandomValues(new Uint16Array(32));
  const str = arr.reduce((p, item) => p + item.toString(16), '');
  const s = [0, 8, 12, 16, 20, 32];
  const uuid: string[] = [];
  for (let i = 0; i < s.length - 1; i++) {
    uuid[i] = str.slice(s[i], s[i + 1]);
  }
  return uuid.join('-');
}
